<script setup>
import { onBeforeUnmount, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter()
const timeout = ref(5)
const intervalId = ref()
onMounted(() => {
    intervalId.value = setInterval(() => {
      timeout.value--
    }, 1000)

    setTimeout(() => {
       router.replace('/userOrder')
    }, 5000)
})

onBeforeUnmount(() => {
    clearInterval(intervalId.value)
})

</script>
<template>
<a href="http://localhost:5173" id="jump">订单提交成功,点击此处跳转,否则{{ timeout }}秒后自动跳转</a>
</template>
<style scoped>
#jump {
    background-color: #ffff;
    color: blue;
    font-size: 30px;
}
</style>
